package org.melanesia.sql;

/**
 * Pagination mode of melanesia.
 *
 * Currently melanesia supports two modes:
 * <ul>
 * <li>{@link #ITERATION_BASED} - in this mode, pagination is done with
 * scrolling. Query is executed "as is", i.e. without any pagination
 * restrictions, and the result set is scrolled using
 * {@link java.sql.ResultSet#next()} to the first required row. The rows are
 * then processed and returned in the
 * {@link org.melanesia.sql.Query#execute(Class)} (or other method), and the
 * result set is scrolled to the end of the result set - again, using
 * {@link java.sql.ResultSet#next()} - in order to calculate total row count and
 * place it in the {@link org.melanesia.sql.RangeCallback}. This mode is
 * vendor-independent, however its performance may by worse than
 * {@link #QUERY_BASED} for really large result sets. It depends on the driver
 * if calling {@link java.sql.ResultSet#next()} actually fetches the data, and
 * if so - performance also depends on the size of the row and can sometimes be
 * unacceptable.</li>
 * <li>{@link #QUERY_BASED} - in this mode pagination is done with additional
 * "SELECT COUNT(...) ..." query, and using result set limitation methods
 * supported by the database. This means, that melanesia requires additional
 * configuration in order to transform queries for fetching required rows only.
 * This configuration must be performed in form of
 * {@link org.melanesia.sql.PaginationSupport} object.
 * </ul>
 *
 * @see org.melanesia.sql.RangeCallback
 * @see org.melanesia.sql.RangeCallback#setTotalRows(long)
 * @see org.melanesia.sql.PaginationSupport
 *
 * @author marcin.kielar
 *
 */
public enum PaginationMode {

    /** Iteration based (vendor independent) pagination mode. */
    ITERATION_BASED,

    /** Query based (requires additional configuration) pagination mode. */
    QUERY_BASED;
}
